<?php

function get_categories() {
	$db = DB::get_instance();
	$r = $db->query("SELECT category_id, name FROM categories");
	$ids = array();
	$names = array();
	foreach ($r as $one) {
		$ids[] = $one["category_id"];
		$names[] = $one["name"];
	}
	return array($ids, $names);
}

function error_page($e) {
	$page_title = "出错啦";
	list($h_cate_ids, $h_cate_names) = get_categories();
	include HOME.DS."views".DS."header.php";
	echo '<p class="error">出错啦！</p>';
	echo '<p> - '.$e->getMessage().'</p>';
	include HOME.DS."views".DS."footer.php";
}